Skip to content

Conversation

@andrewhickman
Copy link
Contributor

Objective

There is currently no way to construct a Time<Fixed> with a non-zero overstep. The only way to test systems which use the overstep is to advance the virtual time and run the RunFixedMainLoop schedule, which is cumbersome.

Solution

Exposes the accumulate_overstep method as a counterpart of discard_overstep.

Testing

This method is covered by existing tests.

@alice-i-cecile alice-i-cecile added D-Trivial Nice and easy! A great choice to get started with Bevy C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it A-Time Involves time keeping and reporting labels Nov 3, 2025
Comment on lines +185 to +191
/// Increase the overstep time accumulated towards new steps.
///
/// This method is provided for use in tests. Ordinarily, the [`run_fixed_main_schedule`] system is responsible for calculating the overstep.
#[inline]
pub fn accumulate_overstep(&mut self, delta: Duration) {
self.context_mut().overstep += delta;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intended for use in tests outside this crate, but AFAIK #[cfg(test)] only works for unit tests within the crate

@alice-i-cecile alice-i-cecile added this pull request to the merge queue Nov 4, 2025
Merged via the queue into bevyengine:main with commit ffd0121 Nov 4, 2025
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Time Involves time keeping and reporting C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Trivial Nice and easy! A great choice to get started with Bevy S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants